home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / COMMUNIC / COMMUTIL / 2258.ZIP / ONCEONLY.ZIP / ONCEONLY.DOC next >
Text File  |  1990-05-05  |  7KB  |  166 lines

  1.                                ONCEONLY.EXE V1.00
  2.                                ------------------
  3.                                Batch File Utility
  4.  
  5.      5th May 1990
  6.  
  7.      Disclaimer
  8.      ----------
  9.  
  10.      This program is being put  into  the  Public  Domain and may be freely
  11.      distributed  on  the  understanding  that  no  responsibility  can  be
  12.      accepted for any problems arising  from  its  use.  To the best of our
  13.      knowledge, it is 'Bug free' and serves its intended purpose.
  14.  
  15.      No charge, other than a nominal charge for duplication and postage may
  16.      be made for it and it should only be supplied as a single ARC or ZIP
  17.      file called ONCEONLY.ARC, or ONCEONLY.ZIP, containing the ONCEONLY.EXE
  18.      and ONCEONLY.DOC files.
  19.  
  20.      Overview
  21.      --------
  22.  
  23.      OnceOnly is a very simple program with one purpose. Every time it is
  24.      run, it returns an errorcode to the batch file from which it was
  25.      called. If the program has not been executed within the specified
  26.      number of days and the system time is later than the specified time,
  27.      it returns an errorlevel of 0, otherwise, an errorlevel of 1.
  28.  
  29.      This provides a simple mechanism for determining whether part of the
  30.      batch file is to be executed or not, allowing you to only run certain
  31.      programs if they have not already been run within the specified
  32.      period and the time of day is later than the specified earliest time
  33.      of day.
  34.  
  35.      OnceOnly is particularly useful in AUTOEXEC.BAT file which you might
  36.      only want to run a program after a certain period of time. An example
  37.      of this would be where you want to do a back up every 3, or 4 days,
  38.      for example. Using OnceOnly, AUTOEXEC.BAT can prompt you to back up,
  39.      or actually run your back up program.
  40.  
  41.  
  42.      Running ONCEONLY
  43.      ----------------
  44.  
  45.      ONCEONLY.EXE should be placed in any directory which is specified by
  46.      the PATH command.
  47.  
  48.      The syntax used to run OnceOnly is:-
  49.  
  50.             ONCEONLY <pathname> /nnn-hh:mm
  51.  
  52.      <pathname>   is required and must be the name of any file on any valid
  53.                   drive and may include the full path and drive letter.
  54.  
  55.      /nnn-hh:mm   is required
  56.                  'nnn' is the minimum number of days since OnceOnly last
  57.                        returned an errorlevel of zero. Valid range is 1-
  58.                        999.
  59.                  'hh'  is the earliest hour of the day at which the
  60.                        program will return an errorlevel of zero.
  61.                  'mm'  is the earliest number of mins after the earliest
  62.                        hour at which the program will return an
  63.                        errorlevel of zero.
  64.  
  65.                  Note: 'hh' and 'mm' MUST each be two digit numbers,
  66.                        separated by a colon ':' and must be separated
  67.                        from the number of days by a hyphen '-'. Leading
  68.                        zeros must be used, if necessary, for the hours
  69.                        and minutes.
  70.  
  71.      NOTE: The file specified by pathname may be a special file for the
  72.            purpose, or any existing file. Whenever OnceOnly is run, the
  73.            time and date stamp of the specified file are changed to the
  74.            current date and time of the computer's clock. You should not,
  75.            therefore, specify the name of a file for which it is important
  76.            that the date of that file is not changed!
  77.  
  78.      The purpose of the 'earliest time' may not be immediately obvious, but
  79.      will be appreciated by Bulletin Board Sysops, in particular, as it
  80.      allows tasks such as back ups to be executed only after a certain time
  81.      of day/night when the BB software recycles after a caller logs off.
  82.  
  83.      Most other users will probably choose to use 00:00 so that the event
  84.      happens, once only, at the start of each day.
  85.  
  86.  
  87.      What The Program Does
  88.      ---------------------
  89.  
  90.      Whenever ONCEONLY is run, the current file date of the specified file
  91.      is read and compared with the date according to the computer's system
  92.      clock and the frequency specified with '/nnn' if any. If the current
  93.      date, less the specified frequency, is earlier than the file date (a
  94.      greater period has elapsed, a check is made to see whether the system
  95.      time is later than the specified earliest time. If so, an Errorlevel
  96.      of 0 is returned, otherwise an Errorlevel of 1. This enables you to
  97.      check the errorlevel in the batch file, on return from the program and
  98.      to conditionally GOTO a different part of the batch file, depending on
  99.      the result. See the example batch file below.
  100.  
  101.      If an Errorlevel of 0 is returned, the date/time stamp of the
  102.      specified file is updated to the current date/time.
  103.  
  104.      OnceOnly makes use of a specified file rather than its own file
  105.      date/time stamp, so that it may be run from any number of different
  106.      batch files, or more than once in the same batch file, but always
  107.      compares the date and time with the specified file. This ensures that
  108.      it always returns the right answer. If its own date/time stamp was
  109.      used, the date/time would only be right once a day.
  110.  
  111.  
  112.      Example command lines
  113.      ---------------------
  114.  
  115.         ONCEONLY TEST.FLE /1-00:00   Repeat daily the first time after
  116.                                      midnight.
  117.         ONCEONLY TEST.FLE /7-00:00   Repeat weekly the first time after
  118.                                      midnight.
  119.         ONCEONLY TEST.FLE /2-12:00   Repeat every 2 days, but only if the
  120.                                      time is after midday. If it is more
  121.                                      than 2 days, an errorlevel of zero
  122.                                      will still be returned as long as the
  123.                                      time is after the specified earliest
  124.                                      time.
  125.         ONCEONLY TEST.FLE /365-00:00 Repeat once a year.
  126.  
  127.  
  128.      A Sample Batch File
  129.      -------------------
  130.  
  131.      The following is an example of an AUTOEXEC.BAT file.
  132.  
  133.          ECHO OFF
  134.          REM Execute the next few commands every time.
  135.          KEYB UK
  136.          PATH=C:\;C:\MSDOS;C:\SUNDRY
  137.          REM check if 7 days have passed and time is after midnight
  138.          ONCEONLY C:\AUTOEXEC.BAT /7-00:00
  139.          IF ERRORLEVEL==1 GOTO Cont
  140.          REM Execute the commands from here to Cont only if errorlevel==0
  141.          REM Insert programs to be periodically executed here.
  142.          :Cont
  143.          REM execute any further commands every time.
  144.  
  145.      In the above example, the name of AUTOEXEC.BAT is used as the
  146.      parameter, but it could just as easily have been a dummy file
  147.      specially for the purpose, or any other file.
  148.  
  149.  
  150.      Update History
  151.      --------------
  152.  
  153.      Version
  154.      1.00 - 03/05/90 - Initial release.
  155.  
  156.  
  157.      David Foster
  158.      H.L.C. Services
  159.      High Leys
  160.      Crook
  161.      Kendal
  162.      Cumbria
  163.      LA8 8LF
  164.  
  165.                                       END
  166.